<%@page import="day9.Address"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ page import="day9.Person"%>
<%@ page import="day9.Address"%>
<%@ page import="java.util.List"%>
<%@ page import="java.util.ArrayList"%>
<%@ page import=" java.util.Map"%>
<%@ page import=" java.util.HashMap"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>

	<%
		request.setAttribute("name", null);
	%>
	<!-- el表达式，获取bean的属性 -->
	<!-- 相当于pageContext.findAttribute("name") -->
	${name}
	<%
		Person p = new Person();
		p.setAge(12);
		request.setAttribute("person", p);
	%>
	${person.age }

	<%
		Person person = new Person();
		Address a = new Address();
		person.setAddress(a);
		request.setAttribute("person", person);
	%>

	${person.address.name }

	<!--  在jsp页面中使用el表达式获取list集合的数据-->

	<%
		Person p1 = new Person();
		p1.setName("sss");
		Person p2 = new Person();
		p2.setName("dddd");
		List list = new ArrayList();
		list.add(p1);
		list.add(p2);
		request.setAttribute("list", list);
	%>
	<!--el表达式获取list集合中指定位置的数据  -->
	${list[0].name }
	
	<!--el表达式获取map集合的数据  -->
	
	
	<%
	Map<String,String> map= new HashMap<String,String>();
	map.put("a", "aaaa");
	map.put("b", "bbbb");
	map.put("c", "ccccc");
	map.put("d", "dddd");
	
	%>
	
	${map["a"]}
	
	<!--用el表达式获取web页面的名称  -->
	<a href="${pageContext.request.contextPath }/NewFile.jsp">点击获取路径</a>
	
	
	
</body>
</html>